/**
 * <pre>
 * Copyright 2008 Antonio Jacob Costa (jacob.costa@gmail.com)
 * 
 * Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at 
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an &quot;AS IS&quot; BASIS, 
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
 * See the License for the specific language governing permissions and 
 * limitations under the License.
 * </pre>
 */
package org.ajc.maximo4eclipse.templates;

import java.io.ByteArrayInputStream;
import java.io.InputStream;

/**
 * <p>
 * Generates the code for the MboSet class.
 * </p>
 * TODO For now the code is hardcoded, the goal is to put it in template files.
 * 
 * @author Antonio Jacob Costa
 */
public class MboSet {
  /**
   * <p>
   * We will initialize file contents with a sample text.
   * </p>
   */
  public static InputStream openContentStream(String mboName, String packageName, String superclassName) {
    String contents = "/**\n"
        + " * \n"
        + " */\n"
        + "package "+packageName+";\n"
        + "\n"
        + "import java.rmi.RemoteException;\n"
        + "\n"
        + "import psdi.mbo.MboServerInterface;\n"
        + "import psdi.util.MXException;\n"
        + "\n"
        + "/**\n"
        + " * Set class for the "+mboName+" Mbo.\n"
        + " *\n"
        + " * <p>\n"
        + " *   Class generated using maximo4eclipse\n"
        + " *   (http://code.google.com/p/maximo4eclipse/)\n"
        + " * </p>\n"
        + " *\n"
        + " */\n"
        + "public class "+mboName+"Set extends "+superclassName+"Set implements "+mboName+"SetRemote {\n"
        + "  /**\n"
        + "   * @param mboSI\n"
        + "   * @throws RemoteException\n"
        + "   */\n"
        + "  public "+mboName+"Set(MboServerInterface mboSI) throws MXException, RemoteException {\n"
        + "    super(mboSI);\n"
        + "  }\n"
        + "\n"
        + "  /**\n"
        + "   * @Override\n"
        + "   * @see " + superclassName + "#getMboInstance(psdi.mbo.MboSet)\n"
        + "   */\n"
        + "  protected psdi.mbo.Mbo getMboInstance(psdi.mbo.MboSet mboSet) throws MXException,\n"
        + "      RemoteException {\n"
        + "    return new "+packageName+"."+mboName+"(mboSet);\n"
        + "  }\n" 
        + "}\n";
    return new ByteArrayInputStream(contents.getBytes());
  }
}
